﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


namespace Araman.Models
{
    using Araman.Models;
    using System.Web.Mvc;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using Araman.Resources;
    using System.Data.Entity;
    public class DbModel : DbContext
    {
        public DbSet<UserModels.Userr> Users { get; set; }
        public DbSet<UserModels.UserGroup> UserGroups { get; set; }
        public DbSet<UserModels.UserPermission> UserPermissions { get; set; }
        public DbSet<UserModels.UserPermissionGroup> UserPermissionGroups { get; set; }
        public DbSet<UserModels.UserStatus> UserStatuses { get; set; }

        public DbSet<LocalizationModels.Country> Countries { get; set; }
        public DbSet<LocalizationModels.Language> Languages { get; set; }



        private static DbModel _dbContext = null;
        private static System.Data.SqlClient.SqlConnection dbContextLocker = new System.Data.SqlClient.SqlConnection();
        public static DbModel Current
        {
            get
            {
                lock (dbContextLocker)
                {
                    if (_dbContext == null)
                    {
                        _dbContext = new DbModel();
                    }
                    return _dbContext;
                }
            }
        }
    }
}